$this->mPassword = $password;
$this->mDBname = $dbName;
$this->mSchemas = array($wgDBschema,'public');
-
+
$success = false;
-
+
if ( '' != $dbName ) {
# start a database connection
$hstring="";
}
return $this->mConn;
}
-
+
/**
* Closes a database connection, if it is open
* Returns success, true if already closed
return true;
}
}
-
+
function doQuery( $sql ) {
return $this->mLastResult=pg_query( $this->mConn , $sql);
}
-
+
function queryIgnore( $sql, $fname = '' ) {
return $this->query( $sql, $fname, true );
}
-
+
function freeResult( $res ) {
if ( !@pg_free_result( $res ) ) {
wfDebugDieBacktrace( "Unable to free PostgreSQL result\n" );
}
}
-
+
function fetchObject( $res ) {
@$row = pg_fetch_object( $res );
# FIXME: HACK HACK HACK HACK debug
-
+
# TODO:
# hashar : not sure if the following test really trigger if the object
# fetching failled.
}
function numFields( $res ) { return pg_num_fields( $res ); }
function fieldName( $res, $n ) { return pg_field_name( $res, $n ); }
-
+
/**
* This must be called after nextSequenceVal
*/
function affectedRows() {
return pg_affected_rows( $this->mLastResult );
}
-
+
/**
* Returns information about an index
* If errors are explicitly ignored, returns NULL on failure
if ( !$res ) {
return NULL;
}
-
+
while ( $row = $this->fetchObject( $res ) ) {
if ( $row->Key_name == $index ) {
return $row;
while ($row = $this->fetchObject( $res ))
return true;
return false;
-
+
}
function fieldInfo( $table, $field ) {
return $retVal;
}
-
+
/** @todo FIXME */
function startTimer( $timeout ) {
wfDebugDieBacktrace( 'Database::startTimer() error : mysql_thread_id() not implemented for postgre' );
case 'old':
case 'group':
return '"' . $name . '"';
-
+
default:
return $name;
}
# occurred in MySQL
function replace( $table, $uniqueIndexes, $rows, $fname = 'Database::replace' ) {
$table = $this->tableName( $table );
-
+
if (count($rows)==0) {
return;
}
$res =$this->query($sql);
$row=$this->fetchObject($res);
if ($row->ftype=="varchar") {
- $size=$row->size-4;
+ $size=$row->size-4;
} else {
$size=$row->size;
}
$this->freeResult( $res );
return $size;
}
-
+
function lowPriorityOption() {
return '';
}
function limitResult($sql, $limit,$offset) {
return "$sql LIMIT $limit ".(is_numeric($offset)?" OFFSET {$offset} ":"");
}
-
+
/**
* Returns an SQL expression for a simple conditional.
* Uses CASE on PostgreSQL.
function getSoftwareLink() {
return "[http://www.postgresql.org/ PostgreSQL]";
}
-
+
/**
* @return string Version information from the database
*/